#include <windows.h>
#include <iostream>
using namespace std;

void mlb();
void mrb();
void kenter();
void pray1();
void pray2();

int main()
{
	cout << "waiting 10s to start." << endl;
	Sleep(10000);

	cout << "life skill" << endl;
	while (1) {
		mlb();
		Sleep(2000);
		mlb();
		Sleep(12000);
	}

	/*
	cout << "upgrade" << endl;
	while (true) {
		pray1();
		Sleep(1000);
		pray2();
		Sleep(7000);
	}
	*/

	cout << "bye" << endl;
	return 0;
}

void mlb()
{
	static INPUT data[2] = {
		{
			INPUT_MOUSE, {
				0, 0, NULL, MOUSEEVENTF_LEFTDOWN, NULL, NULL
			}
		},
		{
			INPUT_MOUSE, {
				0, 0, NULL, MOUSEEVENTF_LEFTUP, NULL, NULL
			}
		}
	};

	SendInput(2, data, sizeof(INPUT));
}

void mrb()
{
	static INPUT data[2] = {
		{
			INPUT_MOUSE, {
				0, 0, NULL, MOUSEEVENTF_RIGHTDOWN, NULL, NULL
			}
		},
		{
			INPUT_MOUSE, {
				0, 0, NULL, MOUSEEVENTF_RIGHTUP, NULL, NULL
		}
		}
	};

	SendInput(2, data, sizeof(INPUT));
}

void kenter()
{
	static INPUT data[1] = {
		{
			INPUT_KEYBOARD, {
				VK_RETURN, NULL, NULL, NULL, NULL
			}
		}
		//,
		//{
		//	INPUT_KEYBOARD, {
		//		VK_RETURN, NULL, KEYEVENTF_KEYUP, NULL, NULL
		//	}
		//}
	};

	SendInput(1, data, sizeof(INPUT));
}


void pray1()
{
	SetCursorPos(961, 443);
	Sleep(200);
	static INPUT data[2] = {
		{
			INPUT_MOUSE, {
				477, -202, NULL, MOUSEEVENTF_RIGHTDOWN, NULL, NULL
			}
		},
		{
			INPUT_MOUSE, {
				0, 0, NULL, MOUSEEVENTF_RIGHTUP, NULL, NULL
			}
		}
	};

	POINT pt;
	GetCursorPos(&pt);
	cout << "RB mouse->{" << pt.x << ", " << pt.y << "}" << endl;

	SendInput(2, data, sizeof(INPUT));
}
void pray2()
{
	SetCursorPos(489, 636);
	Sleep(200);
	static INPUT data[2] = {
		{
			INPUT_MOUSE, {
				-477, 202, NULL, MOUSEEVENTF_LEFTDOWN, NULL, NULL
			}
		},
		{
			INPUT_MOUSE, {
				0, 0, NULL, MOUSEEVENTF_LEFTUP, NULL, NULL
			}
		}
	};
	POINT pt;
	GetCursorPos(&pt);
	cout << "LB mouse->{" << pt.x << ", " << pt.y << "}" << endl;

	SendInput(2, data, sizeof(INPUT));
}